|
|
|
|
|
|
|
There is the entire Win32 APIthousands upon thousands of functions that control virtually every aspect of Windows. And then there is OLE. |
|
|
|
|
|
|
|
|
OLE, short for Object Linking and Embedding, is the old name for ActiveX, a marketing buzzword invented in the days when Microsoft was more afraid of Netscape than of the Department of Justice.1 Nowadays, you are more likely to hear the term COM or COM+ describing those technologies that are part of or implemented by OLE. |
|
|
|
|
|
|
|
|
OLE represents a large subsystem within Windows, and it comes with its own DLLs and API functions. |
|
|
|
|
|
|
|
|
It is extremely important to understand the difference between API functions and object methods and properties that are part of COM. Functions and COM methods can both be implemented by dynamic link libraries, but that is where the similarity ends. |
|
|
|
|
|
|
|
|
With COM, your program must first create an object. The object is implemented by the DLL (or EXE), which provides you with a pointer to the objector, specifically, a pointer to a requested interface for an object. This pointer actually references an array of function pointers for the methods and properties of the interface to the object you have requested. Visual Basic knows how to call methods and properties for certain types of interfaces, but not every interface is compatible with VB. If you want to call methods on an interface that is not compatible with VB, you need to use another DLL to create a wrapper object, define a custom type library for the object that is compatible with VB, or use a tool such as Desaware's SpyWorks, which provides generic access to any interface. |
|
|
|
|
|
|
|
|
But you can't use the Declare statement to access methods or properties of an object. |
|
|
|
|
|
|
|
|
The Declare statement is used exclusively to access functions that are directly exported by a dynamic link library. The DLL contains a list of functions that can be called without creating any objects, using a mechanism that has nothing whatsoever to do with COM. These functions are said to be ''exported" from the DLL. |
|
|
|
 |
|
 |
|
|
1 I wouldn't even begin to hazard a guess as to who, if anyone, Microsoft will be afraid of by the time you read this. |
|
|
|
|
|